package com.cloud.dong.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author DJ
 * @description
 * @date 2022/2/16 9:57 下午
 **/
@RestController
public class OrderController {

    @Resource
    private RestTemplate restTemplate;

    @Value("${server-url.nacos-provider-service}")
    private String serviceURL;

    /**
     * 远程调用
     *
     * @param id
     * @return java.lang.String
     * @author DJ
     * @date 10:01 下午 2022/2/16
     **/
    @GetMapping("/consumer/payment/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Long id) {
        return restTemplate.getForObject(serviceURL + "/payment/nacos/" + id, String.class);
    }

}
